<template>
    <view>
        <view class="weui-cells__title">常见问题</view>
        <view class="weui-cells weui-cells_after-title">
            <navigator
                @tap="tzxq"
                class="weui-cell weui-cell_access"
                :data-answer="item.answer"
                :data-title="item.question"
                hoverClass="weui-cell_active"
                v-for="(item, index) in list"
                :key="index"
            >
                <view class="weui-cell__bd">{{ item.question }}</view>

                <view class="weui-cell__ft weui-cell__ft_in-access"></view>
            </navigator>
        </view>
        <view class="foot flex-row flex-y-center">
            <!-- #ifdef MP-WEIXIN -->
            <button class="flex-grow-1" openType="contact">
              <image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/zxkf1.png"></image>
              <view>在线客服</view>
            </button>
            <view class="sx"></view>
            <!-- #endif -->
            <button @tap="telFun" class="flex-grow-1">
                <image src="https://yunkeososyunchuc.bc8t.cn/ymq_canyino2o/static/telephone.png"></image>
                <view>电话客服</view>
            </button>
        </view>
    </view>
</template>

<script>
import cardlist from '@/ymq_canyino2o/dist/cardlist/index';
import gettel from '@/ymq_canyino2o/dist/gettel/index';
var app = getApp();
export default {
    components: {
        cardlist,
        gettel
    },
    data() {
        return {
            list: [],
            tel: ''
        };
    },
    onLoad: function (t) {
        app.globalData.setNavigationBarColor(this);
        var that = this;
        //console.log(this);
        app.globalData.util.request({
            url: 'entry/wxapp/GetHelp',
            cachetime: '0',
            success: function (t) {
                console.log(t.data);
                that.setData({
                    list: t.data
                });
            }
        });
        app.globalData.util.request({
            url: 'entry/wxapp/system',
            cachetime: '0',
            success: function (t) {
                console.log(t.data);
                that.setData({
                    tel: t.data.tel
                });
            }
        });
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onPullDownRefresh: function () {},
    onReachBottom: function () {},
    onShareAppMessage: function () {},
    methods: {
        kindToggle: function (t) {
            var e = t.currentTarget.id;
            var a = this.list;
            console.log(e);
            for (var n = 0, o = a.length; n < o; ++n) {
                a[n].open = n == e && !a[n].open;
            }
            this.setData({
                list: a
            });
        },

        telFun: function () {
            uni.makePhoneCall({
                phoneNumber: this.tel
            });
        },

        tzxq: function (t) {
            console.log(t.currentTarget.dataset.answer);
            uni.setStorageSync('answer', t.currentTarget.dataset.answer);
            uni.navigateTo({
                url: 'kfzx?title=' + t.currentTarget.dataset.title
            });
        }
    }
};
</script>
<style>
@import './bzzx.css';
</style>
